﻿// Our default grid options
var defaultGridOptions = {
    enableCellNavigation: true,
    enableColumnReorder: false,
    enableAddRow: false,
    editable: true,
    editOnDoubleClick: true,
    multiSelect: false,
    forceFitColumns: false,
    autoHeight: false,
    resizable: false,
    autoEdit: false,
    showHeaderRow: true,
    rowHeight: 36,
    headerHeight: 36,
    headerRowHeight: 36

};

// This function will run when the document has finished loading (not including images).
$().ready(function () {
    var lastSampleId = 0;
    var availabilityGrid = setUpAvailabilityGrid('#availabilityGrid');
    // Turns all buttons with a class of "button" into fancy jQuery UI-themed buttons.
    $('.button').button();


});

// Sets up the sample grid
function setUpAvailabilityGrid(gridSelector) {
    // First, define the grid's columns
    var columns = [
        { id: "Day", name: "Day", field: "Day", showFilter: true, width: 100, sortable: true, editor: Slick.Editors.Text, validator: RequiredFieldValidator },
        { id: "AvailableTimes", name: "AvailableTimes", field: "AvailableTimes", width: 240, sortable: true, showFilter: true, editor: Slick.Editors.Text, validator: RequiredFieldValidator },

    ];


    // Set some additional options
    var options = $.extend(true, {}, defaultGridOptions);
    options.hasHeaderFilters = false;

    var grid = new Slick.Grid(gridSelector, [], columns, options);
    grid.registerPlugin(new Slick.ExtendedGrid(gridSelector, columns, options));
    grid.updateHeaderRow();




    // Return the grid object so we can store it in a variable
    return grid;
}


// This function will run when the document has finished loading (not including images).
$().ready(function () {
    var lastSampleId = 0;
    var skillsGrid = setUpSkillsGrid('#skillsGrid');
    // Turns all buttons with a class of "button" into fancy jQuery UI-themed buttons.
    $('.button').button();


});

// Sets up the sample grid
function setUpSkillsGrid(gridSelector) {
    // First, define the grid's columns
    var columns = [
        { id: "Skills", name: "Skills", field: "Skills", showFilter: true, width: 100, sortable: true, editor: Slick.Editors.Text, validator: RequiredFieldValidator },

    ];


    // Set some additional options
    var options = $.extend(true, {}, defaultGridOptions);
    options.hasHeaderFilters = false;

    var grid = new Slick.Grid(gridSelector, [], columns, options);
    grid.registerPlugin(new Slick.ExtendedGrid(gridSelector, columns, options));
    grid.updateHeaderRow();




    // Return the grid object so we can store it in a variable
    return grid;
}